// Copyright (c) 2019, the Dart project authors.  Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.

import 'package:_fe_analyzer_shared/src/parser/assert.dart';
import 'package:_fe_analyzer_shared/src/parser/block_kind.dart';
import 'package:_fe_analyzer_shared/src/parser/declaration_kind.dart';
import 'package:_fe_analyzer_shared/src/parser/formal_parameter_kind.dart';
import 'package:_fe_analyzer_shared/src/parser/identifier_context.dart';
import 'package:_fe_analyzer_shared/src/parser/listener.dart';
import 'package:_fe_analyzer_shared/src/parser/member_kind.dart';
import 'package:_fe_analyzer_shared/src/scanner/error_token.dart';
import 'package:_fe_analyzer_shared/src/scanner/token.dart';
import 'package:front_end/src/fasta/messages.dart';

// THIS FILE IS AUTO GENERATED BY 'test/parser_test_listener_creator.dart'
// Run e.g.
/*
   out/ReleaseX64/dart \
     pkg/front_end/test/parser_test_listener_creator.dart \
      > pkg/front_end/test/parser_test_listener.dart
*/

class ParserTestListener implements Listener {
  int indent = 0;
  final StringBuffer sb = new StringBuffer();
  final bool trace;

  ParserTestListener(this.trace);

  String createTrace() {
    List<String> traceLines = StackTrace.current.toString().split("\n");
    for (int i = 0; i < traceLines.length; i++) {
      // Find first one that's not any of the blacklisted ones.
      String line = traceLines[i];
      if (line.contains("parser_test_listener.dart:") ||
          line.contains("parser_suite.dart:")) continue;
      return line.substring(line.indexOf("(") + 1, line.lastIndexOf(")"));
    }
    return "N/A";
  }

  void doPrint(String s) {
    String outString = s;
    if (trace) outString += " (${createTrace()})";
    if (outString != "") {
      sb.writeln(("  " * indent) + outString);
    } else {
      sb.writeln("");
    }
  }

  void seen(Token token) {}

  Uri get uri => null;

  void logEvent(String name) {
    doPrint('logEvent(' '$name)');
  }

  set suppressParseErrors(bool value) {
    doPrint('suppressParseErrors(' '$value)');
  }

  void beginArguments(Token token) {
    seen(token);
    doPrint('beginArguments(' '$token)');
    indent++;
  }

  void endArguments(int count, Token beginToken, Token endToken) {
    indent--;
    seen(beginToken);
    seen(endToken);
    doPrint('endArguments(' '$count, ' '$beginToken, ' '$endToken)');
  }

  void handleAsyncModifier(Token asyncToken, Token starToken) {
    seen(asyncToken);
    seen(starToken);
    doPrint('handleAsyncModifier(' '$asyncToken, ' '$starToken)');
  }

  void beginAwaitExpression(Token token) {
    seen(token);
    doPrint('beginAwaitExpression(' '$token)');
    indent++;
  }

  void endAwaitExpression(Token beginToken, Token endToken) {
    indent--;
    seen(beginToken);
    seen(endToken);
    doPrint('endAwaitExpression(' '$beginToken, ' '$endToken)');
  }

  void endInvalidAwaitExpression(
      Token beginToken, Token endToken, MessageCode errorCode) {
    indent--;
    seen(beginToken);
    seen(endToken);
    doPrint('endInvalidAwaitExpression('
        '$beginToken, '
        '$endToken, '
        '$errorCode)');
  }

  void endInvalidYieldStatement(Token beginToken, Token starToken,
      Token endToken, MessageCode errorCode) {
    indent--;
    seen(beginToken);
    seen(starToken);
    seen(endToken);
    doPrint('endInvalidYieldStatement('
        '$beginToken, '
        '$starToken, '
        '$endToken, '
        '$errorCode)');
  }

  void beginBlock(Token token, BlockKind blockKind) {
    seen(token);
    doPrint('beginBlock(' '$token, ' '$blockKind)');
    indent++;
  }

  void endBlock(
      int count, Token beginToken, Token endToken, BlockKind blockKind) {
    indent--;
    seen(beginToken);
    seen(endToken);
    doPrint('endBlock(' '$count, ' '$beginToken, ' '$endToken, ' '$blockKind)');
  }

  void handleInvalidTopLevelBlock(Token token) {
    seen(token);
    doPrint('handleInvalidTopLevelBlock(' '$token)');
  }

  void beginCascade(Token token) {
    seen(token);
    doPrint('beginCascade(' '$token)');
    indent++;
  }

  void endCascade() {
    indent--;
    doPrint('endCascade()');
  }

  void beginCaseExpression(Token caseKeyword) {
    seen(caseKeyword);
    doPrint('beginCaseExpression(' '$caseKeyword)');
    indent++;
  }

  void endCaseExpression(Token colon) {
    indent--;
    seen(colon);
    doPrint('endCaseExpression(' '$colon)');
  }

  void beginClassOrMixinBody(DeclarationKind kind, Token token) {
    seen(token);
    doPrint('beginClassOrMixinBody(' '$kind, ' '$token)');
    indent++;
  }

  void endClassOrMixinBody(
      DeclarationKind kind, int memberCount, Token beginToken, Token endToken) {
    indent--;
    seen(beginToken);
    seen(endToken);
    doPrint('endClassOrMixinBody('
        '$kind, '
        '$memberCount, '
        '$beginToken, '
        '$endToken)');
  }

  void beginClassOrNamedMixinApplicationPrelude(Token token) {
    seen(token);
    doPrint('beginClassOrNamedMixinApplicationPrelude(' '$token)');
    indent++;
  }

  void beginClassDeclaration(Token begin, Token abstractToken, Token name) {
    seen(begin);
    seen(abstractToken);
    seen(name);
    doPrint('beginClassDeclaration(' '$begin, ' '$abstractToken, ' '$name)');
    indent++;
  }

  void handleClassExtends(Token extendsKeyword) {
    seen(extendsKeyword);
    doPrint('handleClassExtends(' '$extendsKeyword)');
  }

  void handleClassOrMixinImplements(
      Token implementsKeyword, int interfacesCount) {
    seen(implementsKeyword);
    doPrint('handleClassOrMixinImplements('
        '$implementsKeyword, '
        '$interfacesCount)');
  }

  void handleClassHeader(Token begin, Token classKeyword, Token nativeToken) {
    seen(begin);
    seen(classKeyword);
    seen(nativeToken);
    doPrint('handleClassHeader(' '$begin, ' '$classKeyword, ' '$nativeToken)');
  }

  void handleRecoverClassHeader() {
    doPrint('handleRecoverClassHeader()');
  }

  void endClassDeclaration(Token beginToken, Token endToken) {
    indent--;
    seen(beginToken);
    seen(endToken);
    doPrint('endClassDeclaration(' '$beginToken, ' '$endToken)');
  }

  void beginMixinDeclaration(Token mixinKeyword, Token name) {
    seen(mixinKeyword);
    seen(name);
    doPrint('beginMixinDeclaration(' '$mixinKeyword, ' '$name)');
    indent++;
  }

  void handleMixinOn(Token onKeyword, int typeCount) {
    seen(onKeyword);
    doPrint('handleMixinOn(' '$onKeyword, ' '$typeCount)');
  }

  void handleMixinHeader(Token mixinKeyword) {
    seen(mixinKeyword);
    doPrint('handleMixinHeader(' '$mixinKeyword)');
  }

  void handleRecoverMixinHeader() {
    doPrint('handleRecoverMixinHeader()');
  }

  void endMixinDeclaration(Token mixinKeyword, Token endToken) {
    indent--;
    seen(mixinKeyword);
    seen(endToken);
    doPrint('endMixinDeclaration(' '$mixinKeyword, ' '$endToken)');
  }

  void beginExtensionDeclarationPrelude(Token extensionKeyword) {
    seen(extensionKeyword);
    doPrint('beginExtensionDeclarationPrelude(' '$extensionKeyword)');
    indent++;
  }

  void beginExtensionDeclaration(Token extensionKeyword, Token name) {
    seen(extensionKeyword);
    seen(name);
    doPrint('beginExtensionDeclaration(' '$extensionKeyword, ' '$name)');
    indent++;
  }

  void endExtensionDeclaration(
      Token extensionKeyword, Token onKeyword, Token token) {
    indent--;
    seen(extensionKeyword);
    seen(onKeyword);
    seen(token);
    doPrint('endExtensionDeclaration('
        '$extensionKeyword, '
        '$onKeyword, '
        '$token)');
  }

  void beginCombinators(Token token) {
    seen(token);
    doPrint('beginCombinators(' '$token)');
    indent++;
  }

  void endCombinators(int count) {
    indent--;
    doPrint('endCombinators(' '$count)');
  }

  void beginCompilationUnit(Token token) {
    seen(token);
    doPrint('beginCompilationUnit(' '$token)');
    indent++;
  }

  void handleDirectivesOnly() {
    doPrint('handleDirectivesOnly()');
  }

  void endCompilationUnit(int count, Token token) {
    indent--;
    seen(token);
    doPrint('endCompilationUnit(' '$count, ' '$token)');
  }

  void beginConstLiteral(Token token) {
    seen(token);
    doPrint('beginConstLiteral(' '$token)');
    indent++;
  }

  void endConstLiteral(Token token) {
    indent--;
    seen(token);
    doPrint('endConstLiteral(' '$token)');
  }

  void beginConstructorReference(Token start) {
    seen(start);
    doPrint('beginConstructorReference(' '$start)');
    indent++;
  }

  void endConstructorReference(
      Token start, Token periodBeforeName, Token endToken) {
    indent--;
    seen(start);
    seen(periodBeforeName);
    seen(endToken);
    doPrint('endConstructorReference('
        '$start, '
        '$periodBeforeName, '
        '$endToken)');
  }

  void beginDoWhileStatement(Token token) {
    seen(token);
    doPrint('beginDoWhileStatement(' '$token)');
    indent++;
  }

  void endDoWhileStatement(
      Token doKeyword, Token whileKeyword, Token endToken) {
    indent--;
    seen(doKeyword);
    seen(whileKeyword);
    seen(endToken);
    doPrint(
        'endDoWhileStatement(' '$doKeyword, ' '$whileKeyword, ' '$endToken)');
  }

  void beginDoWhileStatementBody(Token token) {
    seen(token);
    doPrint('beginDoWhileStatementBody(' '$token)');
    indent++;
  }

  void endDoWhileStatementBody(Token token) {
    indent--;
    seen(token);
    doPrint('endDoWhileStatementBody(' '$token)');
  }

  void beginWhileStatementBody(Token token) {
    seen(token);
    doPrint('beginWhileStatementBody(' '$token)');
    indent++;
  }

  void endWhileStatementBody(Token token) {
    indent--;
    seen(token);
    doPrint('endWhileStatementBody(' '$token)');
  }

  void beginEnum(Token enumKeyword) {
    seen(enumKeyword);
    doPrint('beginEnum(' '$enumKeyword)');
    indent++;
  }

  void endEnum(Token enumKeyword, Token leftBrace, int count) {
    indent--;
    seen(enumKeyword);
    seen(leftBrace);
    doPrint('endEnum(' '$enumKeyword, ' '$leftBrace, ' '$count)');
  }

  void beginExport(Token token) {
    seen(token);
    doPrint('beginExport(' '$token)');
    indent++;
  }

  void endExport(Token exportKeyword, Token semicolon) {
    indent--;
    seen(exportKeyword);
    seen(semicolon);
    doPrint('endExport(' '$exportKeyword, ' '$semicolon)');
  }

  void handleExtraneousExpression(Token token, Message message) {
    seen(token);
    doPrint('handleExtraneousExpression(' '$token, ' '$message)');
  }

  void handleExpressionStatement(Token token) {
    seen(token);
    doPrint('handleExpressionStatement(' '$token)');
  }

  void beginFactoryMethod(
      Token lastConsumed, Token externalToken, Token constToken) {
    seen(lastConsumed);
    seen(externalToken);
    seen(constToken);
    doPrint('beginFactoryMethod('
        '$lastConsumed, '
        '$externalToken, '
        '$constToken)');
    indent++;
  }

  void endClassFactoryMethod(
      Token beginToken, Token factoryKeyword, Token endToken) {
    indent--;
    seen(beginToken);
    seen(factoryKeyword);
    seen(endToken);
    doPrint('endClassFactoryMethod('
        '$beginToken, '
        '$factoryKeyword, '
        '$endToken)');
  }

  void endMixinFactoryMethod(
      Token beginToken, Token factoryKeyword, Token endToken) {
    indent--;
    seen(beginToken);
    seen(factoryKeyword);
    seen(endToken);
    doPrint('endMixinFactoryMethod('
        '$beginToken, '
        '$factoryKeyword, '
        '$endToken)');
  }

  void endExtensionFactoryMethod(
      Token beginToken, Token factoryKeyword, Token endToken) {
    indent--;
    seen(beginToken);
    seen(factoryKeyword);
    seen(endToken);
    doPrint('endExtensionFactoryMethod('
        '$beginToken, '
        '$factoryKeyword, '
        '$endToken)');
  }

  void beginFormalParameter(Token token, MemberKind kind, Token requiredToken,
      Token covariantToken, Token varFinalOrConst) {
    seen(token);
    seen(requiredToken);
    seen(covariantToken);
    seen(varFinalOrConst);
    doPrint('beginFormalParameter('
        '$token, '
        '$kind, '
        '$requiredToken, '
        '$covariantToken, '
        '$varFinalOrConst)');
    indent++;
  }

  void endFormalParameter(
      Token thisKeyword,
      Token periodAfterThis,
      Token nameToken,
      Token initializerStart,
      Token initializerEnd,
      FormalParameterKind kind,
      MemberKind memberKind) {
    indent--;
    seen(thisKeyword);
    seen(periodAfterThis);
    seen(nameToken);
    seen(initializerStart);
    seen(initializerEnd);
    doPrint('endFormalParameter('
        '$thisKeyword, '
        '$periodAfterThis, '
        '$nameToken, '
        '$initializerStart, '
        '$initializerEnd, '
        '$kind, '
        '$memberKind)');
  }

  void handleNoFormalParameters(Token token, MemberKind kind) {
    seen(token);
    doPrint('handleNoFormalParameters(' '$token, ' '$kind)');
  }

  void beginFormalParameters(Token token, MemberKind kind) {
    seen(token);
    doPrint('beginFormalParameters(' '$token, ' '$kind)');
    indent++;
  }

  void endFormalParameters(
      int count, Token beginToken, Token endToken, MemberKind kind) {
    indent--;
    seen(beginToken);
    seen(endToken);
    doPrint('endFormalParameters('
        '$count, '
        '$beginToken, '
        '$endToken, '
        '$kind)');
  }

  void endClassFields(Token staticToken, Token covariantToken, Token lateToken,
      Token varFinalOrConst, int count, Token beginToken, Token endToken) {
    indent--;
    seen(staticToken);
    seen(covariantToken);
    seen(lateToken);
    seen(varFinalOrConst);
    seen(beginToken);
    seen(endToken);
    doPrint('endClassFields('
        '$staticToken, '
        '$covariantToken, '
        '$lateToken, '
        '$varFinalOrConst, '
        '$count, '
        '$beginToken, '
        '$endToken)');
  }

  void endMixinFields(Token staticToken, Token covariantToken, Token lateToken,
      Token varFinalOrConst, int count, Token beginToken, Token endToken) {
    indent--;
    seen(staticToken);
    seen(covariantToken);
    seen(lateToken);
    seen(varFinalOrConst);
    seen(beginToken);
    seen(endToken);
    doPrint('endMixinFields('
        '$staticToken, '
        '$covariantToken, '
        '$lateToken, '
        '$varFinalOrConst, '
        '$count, '
        '$beginToken, '
        '$endToken)');
  }

  void endExtensionFields(
      Token staticToken,
      Token covariantToken,
      Token lateToken,
      Token varFinalOrConst,
      int count,
      Token beginToken,
      Token endToken) {
    indent--;
    seen(staticToken);
    seen(covariantToken);
    seen(lateToken);
    seen(varFinalOrConst);
    seen(beginToken);
    seen(endToken);
    doPrint('endExtensionFields('
        '$staticToken, '
        '$covariantToken, '
        '$lateToken, '
        '$varFinalOrConst, '
        '$count, '
        '$beginToken, '
        '$endToken)');
  }

  void handleForInitializerEmptyStatement(Token token) {
    seen(token);
    doPrint('handleForInitializerEmptyStatement(' '$token)');
  }

  void handleForInitializerExpressionStatement(Token token, bool forIn) {
    seen(token);
    doPrint('handleForInitializerExpressionStatement(' '$token, ' '$forIn)');
  }

  void handleForInitializerLocalVariableDeclaration(Token token, bool forIn) {
    seen(token);
    doPrint(
        'handleForInitializerLocalVariableDeclaration(' '$token, ' '$forIn)');
  }

  void beginForStatement(Token token) {
    seen(token);
    doPrint('beginForStatement(' '$token)');
    indent++;
  }

  void handleForLoopParts(Token forKeyword, Token leftParen,
      Token leftSeparator, int updateExpressionCount) {
    seen(forKeyword);
    seen(leftParen);
    seen(leftSeparator);
    doPrint('handleForLoopParts('
        '$forKeyword, '
        '$leftParen, '
        '$leftSeparator, '
        '$updateExpressionCount)');
  }

  void endForStatement(Token endToken) {
    indent--;
    seen(endToken);
    doPrint('endForStatement(' '$endToken)');
  }

  void beginForStatementBody(Token token) {
    seen(token);
    doPrint('beginForStatementBody(' '$token)');
    indent++;
  }

  void endForStatementBody(Token token) {
    indent--;
    seen(token);
    doPrint('endForStatementBody(' '$token)');
  }

  void handleForInLoopParts(Token awaitToken, Token forToken,
      Token leftParenthesis, Token inKeyword) {
    seen(awaitToken);
    seen(forToken);
    seen(leftParenthesis);
    seen(inKeyword);
    doPrint('handleForInLoopParts('
        '$awaitToken, '
        '$forToken, '
        '$leftParenthesis, '
        '$inKeyword)');
  }

  void endForIn(Token endToken) {
    indent--;
    seen(endToken);
    doPrint('endForIn(' '$endToken)');
  }

  void beginForInExpression(Token token) {
    seen(token);
    doPrint('beginForInExpression(' '$token)');
    indent++;
  }

  void endForInExpression(Token token) {
    indent--;
    seen(token);
    doPrint('endForInExpression(' '$token)');
  }

  void beginForInBody(Token token) {
    seen(token);
    doPrint('beginForInBody(' '$token)');
    indent++;
  }

  void endForInBody(Token token) {
    indent--;
    seen(token);
    doPrint('endForInBody(' '$token)');
  }

  void beginNamedFunctionExpression(Token token) {
    seen(token);
    doPrint('beginNamedFunctionExpression(' '$token)');
    indent++;
  }

  void endNamedFunctionExpression(Token endToken) {
    indent--;
    seen(endToken);
    doPrint('endNamedFunctionExpression(' '$endToken)');
  }

  void beginLocalFunctionDeclaration(Token token) {
    seen(token);
    doPrint('beginLocalFunctionDeclaration(' '$token)');
    indent++;
  }

  void endLocalFunctionDeclaration(Token endToken) {
    indent--;
    seen(endToken);
    doPrint('endLocalFunctionDeclaration(' '$endToken)');
  }

  void beginBlockFunctionBody(Token token) {
    seen(token);
    doPrint('beginBlockFunctionBody(' '$token)');
    indent++;
  }

  void endBlockFunctionBody(int count, Token beginToken, Token endToken) {
    indent--;
    seen(beginToken);
    seen(endToken);
    doPrint('endBlockFunctionBody(' '$count, ' '$beginToken, ' '$endToken)');
  }

  void handleNoFunctionBody(Token token) {
    seen(token);
    doPrint('handleNoFunctionBody(' '$token)');
  }

  void handleFunctionBodySkipped(Token token, bool isExpressionBody) {
    seen(token);
    doPrint('handleFunctionBodySkipped(' '$token, ' '$isExpressionBody)');
  }

  void beginFunctionName(Token token) {
    seen(token);
    doPrint('beginFunctionName(' '$token)');
    indent++;
  }

  void endFunctionName(Token beginToken, Token token) {
    indent--;
    seen(beginToken);
    seen(token);
    doPrint('endFunctionName(' '$beginToken, ' '$token)');
  }

  void beginFunctionTypeAlias(Token token) {
    seen(token);
    doPrint('beginFunctionTypeAlias(' '$token)');
    indent++;
  }

  void endFunctionTypeAlias(
      Token typedefKeyword, Token equals, Token endToken) {
    indent--;
    seen(typedefKeyword);
    seen(equals);
    seen(endToken);
    doPrint(
        'endFunctionTypeAlias(' '$typedefKeyword, ' '$equals, ' '$endToken)');
  }

  void handleClassWithClause(Token withKeyword) {
    seen(withKeyword);
    doPrint('handleClassWithClause(' '$withKeyword)');
  }

  void handleClassNoWithClause() {
    doPrint('handleClassNoWithClause()');
  }

  void beginNamedMixinApplication(
      Token begin, Token abstractToken, Token name) {
    seen(begin);
    seen(abstractToken);
    seen(name);
    doPrint(
        'beginNamedMixinApplication(' '$begin, ' '$abstractToken, ' '$name)');
    indent++;
  }

  void handleNamedMixinApplicationWithClause(Token withKeyword) {
    seen(withKeyword);
    doPrint('handleNamedMixinApplicationWithClause(' '$withKeyword)');
  }

  void endNamedMixinApplication(Token begin, Token classKeyword, Token equals,
      Token implementsKeyword, Token endToken) {
    indent--;
    seen(begin);
    seen(classKeyword);
    seen(equals);
    seen(implementsKeyword);
    seen(endToken);
    doPrint('endNamedMixinApplication('
        '$begin, '
        '$classKeyword, '
        '$equals, '
        '$implementsKeyword, '
        '$endToken)');
  }

  void beginHide(Token hideKeyword) {
    seen(hideKeyword);
    doPrint('beginHide(' '$hideKeyword)');
    indent++;
  }

  void endHide(Token hideKeyword) {
    indent--;
    seen(hideKeyword);
    doPrint('endHide(' '$hideKeyword)');
  }

  void handleIdentifierList(int count) {
    doPrint('handleIdentifierList(' '$count)');
  }

  void beginTypeList(Token token) {
    seen(token);
    doPrint('beginTypeList(' '$token)');
    indent++;
  }

  void endTypeList(int count) {
    indent--;
    doPrint('endTypeList(' '$count)');
  }

  void beginIfStatement(Token token) {
    seen(token);
    doPrint('beginIfStatement(' '$token)');
    indent++;
  }

  void endIfStatement(Token ifToken, Token elseToken) {
    indent--;
    seen(ifToken);
    seen(elseToken);
    doPrint('endIfStatement(' '$ifToken, ' '$elseToken)');
  }

  void beginThenStatement(Token token) {
    seen(token);
    doPrint('beginThenStatement(' '$token)');
    indent++;
  }

  void endThenStatement(Token token) {
    indent--;
    seen(token);
    doPrint('endThenStatement(' '$token)');
  }

  void beginElseStatement(Token token) {
    seen(token);
    doPrint('beginElseStatement(' '$token)');
    indent++;
  }

  void endElseStatement(Token token) {
    indent--;
    seen(token);
    doPrint('endElseStatement(' '$token)');
  }

  void beginImport(Token importKeyword) {
    seen(importKeyword);
    doPrint('beginImport(' '$importKeyword)');
    indent++;
  }

  void handleImportPrefix(Token deferredKeyword, Token asKeyword) {
    seen(deferredKeyword);
    seen(asKeyword);
    doPrint('handleImportPrefix(' '$deferredKeyword, ' '$asKeyword)');
  }

  void endImport(Token importKeyword, Token semicolon) {
    indent--;
    seen(importKeyword);
    seen(semicolon);
    doPrint('endImport(' '$importKeyword, ' '$semicolon)');
  }

  void handleRecoverImport(Token semicolon) {
    seen(semicolon);
    doPrint('handleRecoverImport(' '$semicolon)');
  }

  void beginConditionalUris(Token token) {
    seen(token);
    doPrint('beginConditionalUris(' '$token)');
    indent++;
  }

  void endConditionalUris(int count) {
    indent--;
    doPrint('endConditionalUris(' '$count)');
  }

  void beginConditionalUri(Token ifKeyword) {
    seen(ifKeyword);
    doPrint('beginConditionalUri(' '$ifKeyword)');
    indent++;
  }

  void endConditionalUri(Token ifKeyword, Token leftParen, Token equalSign) {
    indent--;
    seen(ifKeyword);
    seen(leftParen);
    seen(equalSign);
    doPrint('endConditionalUri(' '$ifKeyword, ' '$leftParen, ' '$equalSign)');
  }

  void handleDottedName(int count, Token firstIdentifier) {
    seen(firstIdentifier);
    doPrint('handleDottedName(' '$count, ' '$firstIdentifier)');
  }

  void beginImplicitCreationExpression(Token token) {
    seen(token);
    doPrint('beginImplicitCreationExpression(' '$token)');
    indent++;
  }

  void endImplicitCreationExpression(Token token) {
    indent--;
    seen(token);
    doPrint('endImplicitCreationExpression(' '$token)');
  }

  void beginInitializedIdentifier(Token token) {
    seen(token);
    doPrint('beginInitializedIdentifier(' '$token)');
    indent++;
  }

  void endInitializedIdentifier(Token nameToken) {
    indent--;
    seen(nameToken);
    doPrint('endInitializedIdentifier(' '$nameToken)');
  }

  void beginFieldInitializer(Token token) {
    seen(token);
    doPrint('beginFieldInitializer(' '$token)');
    indent++;
  }

  void endFieldInitializer(Token assignment, Token token) {
    indent--;
    seen(assignment);
    seen(token);
    doPrint('endFieldInitializer(' '$assignment, ' '$token)');
  }

  void handleNoFieldInitializer(Token token) {
    seen(token);
    doPrint('handleNoFieldInitializer(' '$token)');
  }

  void beginVariableInitializer(Token token) {
    seen(token);
    doPrint('beginVariableInitializer(' '$token)');
    indent++;
  }

  void endVariableInitializer(Token assignmentOperator) {
    indent--;
    seen(assignmentOperator);
    doPrint('endVariableInitializer(' '$assignmentOperator)');
  }

  void handleNoVariableInitializer(Token token) {
    seen(token);
    doPrint('handleNoVariableInitializer(' '$token)');
  }

  void beginInitializer(Token token) {
    seen(token);
    doPrint('beginInitializer(' '$token)');
    indent++;
  }

  void endInitializer(Token token) {
    indent--;
    seen(token);
    doPrint('endInitializer(' '$token)');
  }

  void beginInitializers(Token token) {
    seen(token);
    doPrint('beginInitializers(' '$token)');
    indent++;
  }

  void endInitializers(int count, Token beginToken, Token endToken) {
    indent--;
    seen(beginToken);
    seen(endToken);
    doPrint('endInitializers(' '$count, ' '$beginToken, ' '$endToken)');
  }

  void handleNoInitializers() {
    doPrint('handleNoInitializers()');
  }

  void handleInvalidExpression(Token token) {
    seen(token);
    doPrint('handleInvalidExpression(' '$token)');
  }

  void handleInvalidFunctionBody(Token token) {
    seen(token);
    doPrint('handleInvalidFunctionBody(' '$token)');
  }

  void handleInvalidTypeReference(Token token) {
    seen(token);
    doPrint('handleInvalidTypeReference(' '$token)');
  }

  void handleLabel(Token token) {
    seen(token);
    doPrint('handleLabel(' '$token)');
  }

  void beginLabeledStatement(Token token, int labelCount) {
    seen(token);
    doPrint('beginLabeledStatement(' '$token, ' '$labelCount)');
    indent++;
  }

  void endLabeledStatement(int labelCount) {
    indent--;
    doPrint('endLabeledStatement(' '$labelCount)');
  }

  void beginLibraryName(Token token) {
    seen(token);
    doPrint('beginLibraryName(' '$token)');
    indent++;
  }

  void endLibraryName(Token libraryKeyword, Token semicolon) {
    indent--;
    seen(libraryKeyword);
    seen(semicolon);
    doPrint('endLibraryName(' '$libraryKeyword, ' '$semicolon)');
  }

  void handleLiteralMapEntry(Token colon, Token endToken) {
    seen(colon);
    seen(endToken);
    doPrint('handleLiteralMapEntry(' '$colon, ' '$endToken)');
  }

  void beginLiteralString(Token token) {
    seen(token);
    doPrint('beginLiteralString(' '$token)');
    indent++;
  }

  void handleInterpolationExpression(Token leftBracket, Token rightBracket) {
    seen(leftBracket);
    seen(rightBracket);
    doPrint('handleInterpolationExpression(' '$leftBracket, ' '$rightBracket)');
  }

  void endLiteralString(int interpolationCount, Token endToken) {
    indent--;
    seen(endToken);
    doPrint('endLiteralString(' '$interpolationCount, ' '$endToken)');
  }

  void handleStringJuxtaposition(Token startToken, int literalCount) {
    seen(startToken);
    doPrint('handleStringJuxtaposition(' '$startToken, ' '$literalCount)');
  }

  void beginMember() {
    doPrint('beginMember()');
    indent++;
  }

  void handleInvalidMember(Token endToken) {
    seen(endToken);
    doPrint('handleInvalidMember(' '$endToken)');
  }

  void endMember() {
    indent--;
    doPrint('endMember()');
  }

  void beginMethod(Token externalToken, Token staticToken, Token covariantToken,
      Token varFinalOrConst, Token getOrSet, Token name) {
    seen(externalToken);
    seen(staticToken);
    seen(covariantToken);
    seen(varFinalOrConst);
    seen(getOrSet);
    seen(name);
    doPrint('beginMethod('
        '$externalToken, '
        '$staticToken, '
        '$covariantToken, '
        '$varFinalOrConst, '
        '$getOrSet, '
        '$name)');
    indent++;
  }

  void endClassMethod(Token getOrSet, Token beginToken, Token beginParam,
      Token beginInitializers, Token endToken) {
    indent--;
    seen(getOrSet);
    seen(beginToken);
    seen(beginParam);
    seen(beginInitializers);
    seen(endToken);
    doPrint('endClassMethod('
        '$getOrSet, '
        '$beginToken, '
        '$beginParam, '
        '$beginInitializers, '
        '$endToken)');
  }

  void endMixinMethod(Token getOrSet, Token beginToken, Token beginParam,
      Token beginInitializers, Token endToken) {
    indent--;
    seen(getOrSet);
    seen(beginToken);
    seen(beginParam);
    seen(beginInitializers);
    seen(endToken);
    doPrint('endMixinMethod('
        '$getOrSet, '
        '$beginToken, '
        '$beginParam, '
        '$beginInitializers, '
        '$endToken)');
  }

  void endExtensionMethod(Token getOrSet, Token beginToken, Token beginParam,
      Token beginInitializers, Token endToken) {
    indent--;
    seen(getOrSet);
    seen(beginToken);
    seen(beginParam);
    seen(beginInitializers);
    seen(endToken);
    doPrint('endExtensionMethod('
        '$getOrSet, '
        '$beginToken, '
        '$beginParam, '
        '$beginInitializers, '
        '$endToken)');
  }

  void endClassConstructor(Token getOrSet, Token beginToken, Token beginParam,
      Token beginInitializers, Token endToken) {
    indent--;
    seen(getOrSet);
    seen(beginToken);
    seen(beginParam);
    seen(beginInitializers);
    seen(endToken);
    doPrint('endClassConstructor('
        '$getOrSet, '
        '$beginToken, '
        '$beginParam, '
        '$beginInitializers, '
        '$endToken)');
  }

  void endMixinConstructor(Token getOrSet, Token beginToken, Token beginParam,
      Token beginInitializers, Token endToken) {
    indent--;
    seen(getOrSet);
    seen(beginToken);
    seen(beginParam);
    seen(beginInitializers);
    seen(endToken);
    doPrint('endMixinConstructor('
        '$getOrSet, '
        '$beginToken, '
        '$beginParam, '
        '$beginInitializers, '
        '$endToken)');
  }

  void endExtensionConstructor(Token getOrSet, Token beginToken,
      Token beginParam, Token beginInitializers, Token endToken) {
    indent--;
    seen(getOrSet);
    seen(beginToken);
    seen(beginParam);
    seen(beginInitializers);
    seen(endToken);
    doPrint('endExtensionConstructor('
        '$getOrSet, '
        '$beginToken, '
        '$beginParam, '
        '$beginInitializers, '
        '$endToken)');
  }

  void beginMetadataStar(Token token) {
    seen(token);
    doPrint('beginMetadataStar(' '$token)');
    indent++;
  }

  void endMetadataStar(int count) {
    indent--;
    doPrint('endMetadataStar(' '$count)');
  }

  void beginMetadata(Token token) {
    seen(token);
    doPrint('beginMetadata(' '$token)');
    indent++;
  }

  void endMetadata(Token beginToken, Token periodBeforeName, Token endToken) {
    indent--;
    seen(beginToken);
    seen(periodBeforeName);
    seen(endToken);
    doPrint('endMetadata(' '$beginToken, ' '$periodBeforeName, ' '$endToken)');
  }

  void beginOptionalFormalParameters(Token token) {
    seen(token);
    doPrint('beginOptionalFormalParameters(' '$token)');
    indent++;
  }

  void endOptionalFormalParameters(
      int count, Token beginToken, Token endToken) {
    indent--;
    seen(beginToken);
    seen(endToken);
    doPrint(
        'endOptionalFormalParameters(' '$count, ' '$beginToken, ' '$endToken)');
  }

  void beginPart(Token token) {
    seen(token);
    doPrint('beginPart(' '$token)');
    indent++;
  }

  void endPart(Token partKeyword, Token semicolon) {
    indent--;
    seen(partKeyword);
    seen(semicolon);
    doPrint('endPart(' '$partKeyword, ' '$semicolon)');
  }

  void beginPartOf(Token token) {
    seen(token);
    doPrint('beginPartOf(' '$token)');
    indent++;
  }

  void endPartOf(
      Token partKeyword, Token ofKeyword, Token semicolon, bool hasName) {
    indent--;
    seen(partKeyword);
    seen(ofKeyword);
    seen(semicolon);
    doPrint('endPartOf('
        '$partKeyword, '
        '$ofKeyword, '
        '$semicolon, '
        '$hasName)');
  }

  void beginRedirectingFactoryBody(Token token) {
    seen(token);
    doPrint('beginRedirectingFactoryBody(' '$token)');
    indent++;
  }

  void endRedirectingFactoryBody(Token beginToken, Token endToken) {
    indent--;
    seen(beginToken);
    seen(endToken);
    doPrint('endRedirectingFactoryBody(' '$beginToken, ' '$endToken)');
  }

  void beginReturnStatement(Token token) {
    seen(token);
    doPrint('beginReturnStatement(' '$token)');
    indent++;
  }

  void handleNativeFunctionBody(Token nativeToken, Token semicolon) {
    seen(nativeToken);
    seen(semicolon);
    doPrint('handleNativeFunctionBody(' '$nativeToken, ' '$semicolon)');
  }

  void handleNativeFunctionBodyIgnored(Token nativeToken, Token semicolon) {
    seen(nativeToken);
    seen(semicolon);
    doPrint('handleNativeFunctionBodyIgnored(' '$nativeToken, ' '$semicolon)');
  }

  void handleNativeFunctionBodySkipped(Token nativeToken, Token semicolon) {
    seen(nativeToken);
    seen(semicolon);
    doPrint('handleNativeFunctionBodySkipped(' '$nativeToken, ' '$semicolon)');
  }

  void handleEmptyFunctionBody(Token semicolon) {
    seen(semicolon);
    doPrint('handleEmptyFunctionBody(' '$semicolon)');
  }

  void handleExpressionFunctionBody(Token arrowToken, Token endToken) {
    seen(arrowToken);
    seen(endToken);
    doPrint('handleExpressionFunctionBody(' '$arrowToken, ' '$endToken)');
  }

  void endReturnStatement(
      bool hasExpression, Token beginToken, Token endToken) {
    indent--;
    seen(beginToken);
    seen(endToken);
    doPrint(
        'endReturnStatement(' '$hasExpression, ' '$beginToken, ' '$endToken)');
  }

  void handleSend(Token beginToken, Token endToken) {
    seen(beginToken);
    seen(endToken);
    doPrint('handleSend(' '$beginToken, ' '$endToken)');
  }

  void beginShow(Token showKeyword) {
    seen(showKeyword);
    doPrint('beginShow(' '$showKeyword)');
    indent++;
  }

  void endShow(Token showKeyword) {
    indent--;
    seen(showKeyword);
    doPrint('endShow(' '$showKeyword)');
  }

  void beginSwitchStatement(Token token) {
    seen(token);
    doPrint('beginSwitchStatement(' '$token)');
    indent++;
  }

  void endSwitchStatement(Token switchKeyword, Token endToken) {
    indent--;
    seen(switchKeyword);
    seen(endToken);
    doPrint('endSwitchStatement(' '$switchKeyword, ' '$endToken)');
  }

  void beginSwitchBlock(Token token) {
    seen(token);
    doPrint('beginSwitchBlock(' '$token)');
    indent++;
  }

  void endSwitchBlock(int caseCount, Token beginToken, Token endToken) {
    indent--;
    seen(beginToken);
    seen(endToken);
    doPrint('endSwitchBlock(' '$caseCount, ' '$beginToken, ' '$endToken)');
  }

  void beginLiteralSymbol(Token token) {
    seen(token);
    doPrint('beginLiteralSymbol(' '$token)');
    indent++;
  }

  void endLiteralSymbol(Token hashToken, int identifierCount) {
    indent--;
    seen(hashToken);
    doPrint('endLiteralSymbol(' '$hashToken, ' '$identifierCount)');
  }

  void handleThrowExpression(Token throwToken, Token endToken) {
    seen(throwToken);
    seen(endToken);
    doPrint('handleThrowExpression(' '$throwToken, ' '$endToken)');
  }

  void beginRethrowStatement(Token token) {
    seen(token);
    doPrint('beginRethrowStatement(' '$token)');
    indent++;
  }

  void endRethrowStatement(Token rethrowToken, Token endToken) {
    indent--;
    seen(rethrowToken);
    seen(endToken);
    doPrint('endRethrowStatement(' '$rethrowToken, ' '$endToken)');
  }

  void endTopLevelDeclaration(Token token) {
    indent--;
    seen(token);
    doPrint('endTopLevelDeclaration(' '$token)');
  }

  void handleInvalidTopLevelDeclaration(Token endToken) {
    seen(endToken);
    doPrint('handleInvalidTopLevelDeclaration(' '$endToken)');
  }

  void beginTopLevelMember(Token token) {
    seen(token);
    doPrint('beginTopLevelMember(' '$token)');
    indent++;
  }

  void endTopLevelFields(
      Token staticToken,
      Token covariantToken,
      Token lateToken,
      Token varFinalOrConst,
      int count,
      Token beginToken,
      Token endToken) {
    indent--;
    seen(staticToken);
    seen(covariantToken);
    seen(lateToken);
    seen(varFinalOrConst);
    seen(beginToken);
    seen(endToken);
    doPrint('endTopLevelFields('
        '$staticToken, '
        '$covariantToken, '
        '$lateToken, '
        '$varFinalOrConst, '
        '$count, '
        '$beginToken, '
        '$endToken)');
  }

  void beginTopLevelMethod(Token lastConsumed, Token externalToken) {
    seen(lastConsumed);
    seen(externalToken);
    doPrint('beginTopLevelMethod(' '$lastConsumed, ' '$externalToken)');
    indent++;
  }

  void endTopLevelMethod(Token beginToken, Token getOrSet, Token endToken) {
    indent--;
    seen(beginToken);
    seen(getOrSet);
    seen(endToken);
    doPrint('endTopLevelMethod(' '$beginToken, ' '$getOrSet, ' '$endToken)');
  }

  void beginTryStatement(Token token) {
    seen(token);
    doPrint('beginTryStatement(' '$token)');
    indent++;
  }

  void handleCaseMatch(Token caseKeyword, Token colon) {
    seen(caseKeyword);
    seen(colon);
    doPrint('handleCaseMatch(' '$caseKeyword, ' '$colon)');
  }

  void beginCatchClause(Token token) {
    seen(token);
    doPrint('beginCatchClause(' '$token)');
    indent++;
  }

  void endCatchClause(Token token) {
    indent--;
    seen(token);
    doPrint('endCatchClause(' '$token)');
  }

  void handleCatchBlock(Token onKeyword, Token catchKeyword, Token comma) {
    seen(onKeyword);
    seen(catchKeyword);
    seen(comma);
    doPrint('handleCatchBlock(' '$onKeyword, ' '$catchKeyword, ' '$comma)');
  }

  void handleFinallyBlock(Token finallyKeyword) {
    seen(finallyKeyword);
    doPrint('handleFinallyBlock(' '$finallyKeyword)');
  }

  void endTryStatement(int catchCount, Token tryKeyword, Token finallyKeyword) {
    indent--;
    seen(tryKeyword);
    seen(finallyKeyword);
    doPrint(
        'endTryStatement(' '$catchCount, ' '$tryKeyword, ' '$finallyKeyword)');
  }

  void handleType(Token beginToken, Token questionMark) {
    seen(beginToken);
    seen(questionMark);
    doPrint('handleType(' '$beginToken, ' '$questionMark)');
  }

  void handleNonNullAssertExpression(Token bang) {
    seen(bang);
    doPrint('handleNonNullAssertExpression(' '$bang)');
  }

  void handleNoName(Token token) {
    seen(token);
    doPrint('handleNoName(' '$token)');
  }

  void beginFunctionType(Token beginToken) {
    seen(beginToken);
    doPrint('beginFunctionType(' '$beginToken)');
    indent++;
  }

  void endFunctionType(Token functionToken, Token questionMark) {
    indent--;
    seen(functionToken);
    seen(questionMark);
    doPrint('endFunctionType(' '$functionToken, ' '$questionMark)');
  }

  void beginTypeArguments(Token token) {
    seen(token);
    doPrint('beginTypeArguments(' '$token)');
    indent++;
  }

  void endTypeArguments(int count, Token beginToken, Token endToken) {
    indent--;
    seen(beginToken);
    seen(endToken);
    doPrint('endTypeArguments(' '$count, ' '$beginToken, ' '$endToken)');
  }

  void handleInvalidTypeArguments(Token token) {
    seen(token);
    doPrint('handleInvalidTypeArguments(' '$token)');
  }

  void handleNoTypeArguments(Token token) {
    seen(token);
    doPrint('handleNoTypeArguments(' '$token)');
  }

  void beginTypeVariable(Token token) {
    seen(token);
    doPrint('beginTypeVariable(' '$token)');
    indent++;
  }

  void handleTypeVariablesDefined(Token token, int count) {
    seen(token);
    doPrint('handleTypeVariablesDefined(' '$token, ' '$count)');
  }

  void endTypeVariable(
      Token token, int index, Token extendsOrSuper, Token variance) {
    indent--;
    seen(token);
    seen(extendsOrSuper);
    seen(variance);
    doPrint('endTypeVariable('
        '$token, '
        '$index, '
        '$extendsOrSuper, '
        '$variance)');
  }

  void beginTypeVariables(Token token) {
    seen(token);
    doPrint('beginTypeVariables(' '$token)');
    indent++;
  }

  void endTypeVariables(Token beginToken, Token endToken) {
    indent--;
    seen(beginToken);
    seen(endToken);
    doPrint('endTypeVariables(' '$beginToken, ' '$endToken)');
  }

  void reportVarianceModifierNotEnabled(Token variance) {
    seen(variance);
    doPrint('reportVarianceModifierNotEnabled(' '$variance)');
  }

  void beginFunctionExpression(Token token) {
    seen(token);
    doPrint('beginFunctionExpression(' '$token)');
    indent++;
  }

  void endFunctionExpression(Token beginToken, Token token) {
    indent--;
    seen(beginToken);
    seen(token);
    doPrint('endFunctionExpression(' '$beginToken, ' '$token)');
  }

  void beginVariablesDeclaration(
      Token token, Token lateToken, Token varFinalOrConst) {
    seen(token);
    seen(lateToken);
    seen(varFinalOrConst);
    doPrint('beginVariablesDeclaration('
        '$token, '
        '$lateToken, '
        '$varFinalOrConst)');
    indent++;
  }

  void endVariablesDeclaration(int count, Token endToken) {
    indent--;
    seen(endToken);
    doPrint('endVariablesDeclaration(' '$count, ' '$endToken)');
  }

  void beginWhileStatement(Token token) {
    seen(token);
    doPrint('beginWhileStatement(' '$token)');
    indent++;
  }

  void endWhileStatement(Token whileKeyword, Token endToken) {
    indent--;
    seen(whileKeyword);
    seen(endToken);
    doPrint('endWhileStatement(' '$whileKeyword, ' '$endToken)');
  }

  void beginAsOperatorType(Token operator) {
    seen(operator);
    doPrint('beginAsOperatorType(' '$operator)');
    indent++;
  }

  void endAsOperatorType(Token operator) {
    indent--;
    seen(operator);
    doPrint('endAsOperatorType(' '$operator)');
  }

  void handleAsOperator(Token operator) {
    seen(operator);
    doPrint('handleAsOperator(' '$operator)');
  }

  void handleAssignmentExpression(Token token) {
    seen(token);
    doPrint('handleAssignmentExpression(' '$token)');
  }

  void beginBinaryExpression(Token token) {
    seen(token);
    doPrint('beginBinaryExpression(' '$token)');
  }

  void endBinaryExpression(Token token) {
    seen(token);
    doPrint('endBinaryExpression(' '$token)');
  }

  void beginConditionalExpression(Token question) {
    seen(question);
    doPrint('beginConditionalExpression(' '$question)');
    indent++;
  }

  void handleConditionalExpressionColon() {
    doPrint('handleConditionalExpressionColon()');
  }

  void endConditionalExpression(Token question, Token colon) {
    indent--;
    seen(question);
    seen(colon);
    doPrint('endConditionalExpression(' '$question, ' '$colon)');
  }

  void beginConstExpression(Token constKeyword) {
    seen(constKeyword);
    doPrint('beginConstExpression(' '$constKeyword)');
    indent++;
  }

  void endConstExpression(Token token) {
    indent--;
    seen(token);
    doPrint('endConstExpression(' '$token)');
  }

  void beginForControlFlow(Token awaitToken, Token forToken) {
    seen(awaitToken);
    seen(forToken);
    doPrint('beginForControlFlow(' '$awaitToken, ' '$forToken)');
    indent++;
  }

  void endForControlFlow(Token token) {
    indent--;
    seen(token);
    doPrint('endForControlFlow(' '$token)');
  }

  void endForInControlFlow(Token token) {
    indent--;
    seen(token);
    doPrint('endForInControlFlow(' '$token)');
  }

  void beginIfControlFlow(Token ifToken) {
    seen(ifToken);
    doPrint('beginIfControlFlow(' '$ifToken)');
    indent++;
  }

  void beginThenControlFlow(Token token) {
    seen(token);
    doPrint('beginThenControlFlow(' '$token)');
    indent++;
  }

  void handleElseControlFlow(Token elseToken) {
    seen(elseToken);
    doPrint('handleElseControlFlow(' '$elseToken)');
  }

  void endIfControlFlow(Token token) {
    indent--;
    seen(token);
    doPrint('endIfControlFlow(' '$token)');
  }

  void endIfElseControlFlow(Token token) {
    indent--;
    seen(token);
    doPrint('endIfElseControlFlow(' '$token)');
  }

  void handleSpreadExpression(Token spreadToken) {
    seen(spreadToken);
    doPrint('handleSpreadExpression(' '$spreadToken)');
  }

  void beginFunctionTypedFormalParameter(Token token) {
    seen(token);
    doPrint('beginFunctionTypedFormalParameter(' '$token)');
    indent++;
  }

  void endFunctionTypedFormalParameter(Token nameToken, Token question) {
    indent--;
    seen(nameToken);
    seen(question);
    doPrint('endFunctionTypedFormalParameter(' '$nameToken, ' '$question)');
  }

  void handleIdentifier(Token token, IdentifierContext context) {
    seen(token);
    doPrint('handleIdentifier(' '$token, ' '$context)');
  }

  void handleIndexedExpression(
      Token question, Token openSquareBracket, Token closeSquareBracket) {
    seen(question);
    seen(openSquareBracket);
    seen(closeSquareBracket);
    doPrint('handleIndexedExpression('
        '$question, '
        '$openSquareBracket, '
        '$closeSquareBracket)');
  }

  void beginIsOperatorType(Token operator) {
    seen(operator);
    doPrint('beginIsOperatorType(' '$operator)');
    indent++;
  }

  void endIsOperatorType(Token operator) {
    indent--;
    seen(operator);
    doPrint('endIsOperatorType(' '$operator)');
  }

  void handleIsOperator(Token isOperator, Token not) {
    seen(isOperator);
    seen(not);
    doPrint('handleIsOperator(' '$isOperator, ' '$not)');
  }

  void handleLiteralBool(Token token) {
    seen(token);
    doPrint('handleLiteralBool(' '$token)');
  }

  void handleBreakStatement(
      bool hasTarget, Token breakKeyword, Token endToken) {
    seen(breakKeyword);
    seen(endToken);
    doPrint(
        'handleBreakStatement(' '$hasTarget, ' '$breakKeyword, ' '$endToken)');
  }

  void handleContinueStatement(
      bool hasTarget, Token continueKeyword, Token endToken) {
    seen(continueKeyword);
    seen(endToken);
    doPrint('handleContinueStatement('
        '$hasTarget, '
        '$continueKeyword, '
        '$endToken)');
  }

  void handleEmptyStatement(Token token) {
    seen(token);
    doPrint('handleEmptyStatement(' '$token)');
  }

  void beginAssert(Token assertKeyword, Assert kind) {
    seen(assertKeyword);
    doPrint('beginAssert(' '$assertKeyword, ' '$kind)');
    indent++;
  }

  void endAssert(Token assertKeyword, Assert kind, Token leftParenthesis,
      Token commaToken, Token semicolonToken) {
    indent--;
    seen(assertKeyword);
    seen(leftParenthesis);
    seen(commaToken);
    seen(semicolonToken);
    doPrint('endAssert('
        '$assertKeyword, '
        '$kind, '
        '$leftParenthesis, '
        '$commaToken, '
        '$semicolonToken)');
  }

  void handleLiteralDouble(Token token) {
    seen(token);
    doPrint('handleLiteralDouble(' '$token)');
  }

  void handleLiteralInt(Token token) {
    seen(token);
    doPrint('handleLiteralInt(' '$token)');
  }

  void handleLiteralList(
      int count, Token leftBracket, Token constKeyword, Token rightBracket) {
    seen(leftBracket);
    seen(constKeyword);
    seen(rightBracket);
    doPrint('handleLiteralList('
        '$count, '
        '$leftBracket, '
        '$constKeyword, '
        '$rightBracket)');
  }

  void handleLiteralSetOrMap(
    int count,
    Token leftBrace,
    Token constKeyword,
    Token rightBrace,
    bool hasSetEntry,
  ) {
    seen(leftBrace);
    seen(constKeyword);
    seen(rightBrace);
    doPrint('handleLiteralSetOrMap('
        '$count, '
        '$leftBrace, '
        '$constKeyword, '
        '$rightBrace, '
        '$hasSetEntry)');
  }

  void handleLiteralNull(Token token) {
    seen(token);
    doPrint('handleLiteralNull(' '$token)');
  }

  void handleNativeClause(Token nativeToken, bool hasName) {
    seen(nativeToken);
    doPrint('handleNativeClause(' '$nativeToken, ' '$hasName)');
  }

  void handleNamedArgument(Token colon) {
    seen(colon);
    doPrint('handleNamedArgument(' '$colon)');
  }

  void beginNewExpression(Token token) {
    seen(token);
    doPrint('beginNewExpression(' '$token)');
    indent++;
  }

  void endNewExpression(Token token) {
    indent--;
    seen(token);
    doPrint('endNewExpression(' '$token)');
  }

  void handleNoArguments(Token token) {
    seen(token);
    doPrint('handleNoArguments(' '$token)');
  }

  void handleNoConstructorReferenceContinuationAfterTypeArguments(Token token) {
    seen(token);
    doPrint('handleNoConstructorReferenceContinuationAfterTypeArguments('
        '$token)');
  }

  void handleNoType(Token lastConsumed) {
    seen(lastConsumed);
    doPrint('handleNoType(' '$lastConsumed)');
  }

  void handleNoTypeVariables(Token token) {
    seen(token);
    doPrint('handleNoTypeVariables(' '$token)');
  }

  void handleOperator(Token token) {
    seen(token);
    doPrint('handleOperator(' '$token)');
  }

  void handleSymbolVoid(Token token) {
    seen(token);
    doPrint('handleSymbolVoid(' '$token)');
  }

  void handleOperatorName(Token operatorKeyword, Token token) {
    seen(operatorKeyword);
    seen(token);
    doPrint('handleOperatorName(' '$operatorKeyword, ' '$token)');
  }

  void handleInvalidOperatorName(Token operatorKeyword, Token token) {
    seen(operatorKeyword);
    seen(token);
    doPrint('handleInvalidOperatorName(' '$operatorKeyword, ' '$token)');
  }

  void handleParenthesizedCondition(Token token) {
    seen(token);
    doPrint('handleParenthesizedCondition(' '$token)');
  }

  void handleParenthesizedExpression(Token token) {
    seen(token);
    doPrint('handleParenthesizedExpression(' '$token)');
  }

  void handleQualified(Token period) {
    seen(period);
    doPrint('handleQualified(' '$period)');
  }

  void handleStringPart(Token token) {
    seen(token);
    doPrint('handleStringPart(' '$token)');
  }

  void handleSuperExpression(Token token, IdentifierContext context) {
    seen(token);
    doPrint('handleSuperExpression(' '$token, ' '$context)');
  }

  void beginSwitchCase(int labelCount, int expressionCount, Token firstToken) {
    seen(firstToken);
    doPrint(
        'beginSwitchCase(' '$labelCount, ' '$expressionCount, ' '$firstToken)');
    indent++;
  }

  void endSwitchCase(
      int labelCount,
      int expressionCount,
      Token defaultKeyword,
      Token colonAfterDefault,
      int statementCount,
      Token firstToken,
      Token endToken) {
    indent--;
    seen(defaultKeyword);
    seen(colonAfterDefault);
    seen(firstToken);
    seen(endToken);
    doPrint('endSwitchCase('
        '$labelCount, '
        '$expressionCount, '
        '$defaultKeyword, '
        '$colonAfterDefault, '
        '$statementCount, '
        '$firstToken, '
        '$endToken)');
  }

  void handleThisExpression(Token token, IdentifierContext context) {
    seen(token);
    doPrint('handleThisExpression(' '$token, ' '$context)');
  }

  void handleUnaryPostfixAssignmentExpression(Token token) {
    seen(token);
    doPrint('handleUnaryPostfixAssignmentExpression(' '$token)');
  }

  void handleUnaryPrefixExpression(Token token) {
    seen(token);
    doPrint('handleUnaryPrefixExpression(' '$token)');
  }

  void handleUnaryPrefixAssignmentExpression(Token token) {
    seen(token);
    doPrint('handleUnaryPrefixAssignmentExpression(' '$token)');
  }

  void beginFormalParameterDefaultValueExpression() {
    doPrint('beginFormalParameterDefaultValueExpression()');
    indent++;
  }

  void endFormalParameterDefaultValueExpression() {
    indent--;
    doPrint('endFormalParameterDefaultValueExpression()');
  }

  void handleValuedFormalParameter(Token equals, Token token) {
    seen(equals);
    seen(token);
    doPrint('handleValuedFormalParameter(' '$equals, ' '$token)');
  }

  void handleFormalParameterWithoutValue(Token token) {
    seen(token);
    doPrint('handleFormalParameterWithoutValue(' '$token)');
  }

  void handleVoidKeyword(Token token) {
    seen(token);
    doPrint('handleVoidKeyword(' '$token)');
  }

  void handleVoidKeywordWithTypeArguments(Token token) {
    seen(token);
    doPrint('handleVoidKeywordWithTypeArguments(' '$token)');
  }

  void beginYieldStatement(Token token) {
    seen(token);
    doPrint('beginYieldStatement(' '$token)');
    indent++;
  }

  void endYieldStatement(Token yieldToken, Token starToken, Token endToken) {
    indent--;
    seen(yieldToken);
    seen(starToken);
    seen(endToken);
    doPrint('endYieldStatement(' '$yieldToken, ' '$starToken, ' '$endToken)');
  }

  void handleRecoverableError(
      Message message, Token startToken, Token endToken) {
    seen(startToken);
    seen(endToken);
    doPrint(
        'handleRecoverableError(' '$message, ' '$startToken, ' '$endToken)');
  }

  void handleErrorToken(ErrorToken token) {
    doPrint('handleErrorToken(' '$token)');
  }

  void handleUnescapeError(
      Message message, Token location, int stringOffset, int length) {
    seen(location);
    doPrint('handleUnescapeError('
        '$message, '
        '$location, '
        '$stringOffset, '
        '$length)');
  }

  void handleInvalidStatement(Token token, Message message) {
    seen(token);
    doPrint('handleInvalidStatement(' '$token, ' '$message)');
  }

  void handleScript(Token token) {
    seen(token);
    doPrint('handleScript(' '$token)');
  }

  void discardTypeReplacedWithCommentTypeAssign() {
    doPrint('discardTypeReplacedWithCommentTypeAssign()');
  }

  void handleCommentReferenceText(String referenceSource, int referenceOffset) {
    doPrint(
        'handleCommentReferenceText(' '$referenceSource, ' '$referenceOffset)');
  }

  void handleCommentReference(
      Token newKeyword, Token prefix, Token period, Token token) {
    seen(newKeyword);
    seen(prefix);
    seen(period);
    seen(token);
    doPrint('handleCommentReference('
        '$newKeyword, '
        '$prefix, '
        '$period, '
        '$token)');
  }

  void handleNoCommentReference() {
    doPrint('handleNoCommentReference()');
  }
}
